It is desirable to be able to view data object structures for a variety of reasons. Most C/C++ based software products have a considerable number of complex data types including ‘union’, ‘structure’ or ‘classes’ that consists of one or more native types and possibly other complex data types. Many of the data types for a large software product are complex and they are not native. Native by definition are all the data types any existing compiler recognizes, commonly, but not limited to numbers, characters, dates, times, etc. Complex data type is a combination of native types and other complex types. For example a person's mailing address may be a combination of house number, street, city, country, postal/zip code. Each of these is a native type (number and list of characters). Surprisingly, there is no easy way to format these complex data types into a form that is easily readable by program developers thus enabling them to more easily and quickly diagnose problems in the source code they are developing. Currently, code developers are experiencing a very difficult task of determining how to display or otherwise output this complex information (contained in the complex data types) in a human readable form for troubleshooting source code during code development. In particular, the complex data types are not predefined and are therefore the software products have difficulties in supporting printing formats of the data.
Some known methods for resolving this problem include:
a) manually formatting complex data types,
b) using a debugger, or
c) some form of post compilation method.
A common practice for developers or service analysts is to manually format raw memory (usually in hexadecimal form) into a more human readable format. This manual process is error prone and requires intimate knowledge of the fields in the data structures (or classes), sizes, alignment, byte order, hardware architecture, etc., requiring much time and thus incurring unwanted cost.
As a result, much time is spent formatting the information related to the complex data. For example, using the mailing address above, to format manually you will need to study the complex data structure and from that determine where the house number ends and the street name begins. Then where the street name ends and the city name starts, analysis is continued this way for all fields in the complex data type. If you miscalculate a beginning or ending location your analysis will be error prone and result in wasted time and effort until the mistake is realized and the calculation corrected.
Additionally, using a debugger to format complex data types requires a software product to be built with extra debug information. This results in larger and slower programs possibly affecting the nature of the problem. A debugger may not be available on a customer's machine and customer may not want to purchase one. Debuggers often incur significant overhead in load on a system and slow down the normal execution of a program. This slowdown could drastically affect the occurrence of the problem, thus making it difficult to reproduce and solve.
Another solution is for the program developer to write custom program logic to print complex data types without relying on a compiler to generate the code for printing. The problem here is additional work placed on the program developer, and more importantly, should the complex data type ever change by the addition or removal of a field, then the program developers needs to remember to update their custom written print logic to handle the addition or removal. This is very error prone and possibly time consuming depending on the amount of change.
Post compilation methods are also not well suited for logging error messages with complex data types, and these methods require extra complexity in the development environment.
Known debuggers may provide a function for printing complex data structures. Known debuggers also display memory in a formatted form, variable by variable, structure by structure, and they allow the expanding of structures and arrays to see contents and nested structures. An example of this is the IBM Distributed Debugger product. The disadvantage provided by known debuggers is that they are supplied as a separate product, and they operate independently of the software program product that requires debugging. A debugger provides a very complicated solution. What is needed is a simple solution that does not require other programs (that is debuggers) to be operating while the software that requires debugging operates. Known debuggers require a very large learning curve. They also require the computer program being debugged to be active and executing while the debugger is active. The debugger requires debuggable code, whereas most production environments require highly optimized code for performance as well as size requirements. Known debuggers interact with running programs, and thus affecting performance which may affect the timing within the program and thus affect the problem occurrence.
Accordingly, a solution that addresses, at least in part, this and other shortcomings is desired.